package com.charles.seckillsystem.controller.admin;

import com.charles.seckillcommon.core.controller.BaseController;
import com.charles.seckillcommon.core.domain.TableInfo;
import com.charles.seckillcommon.security.annotation.RolePermit;
import com.charles.seckillsystem.form.admin.UserListQuerys;
import com.charles.seckillsystem.mapper.SysUserMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/admin/user")
public class AdminUserController extends BaseController {
    
    @Resource
    private SysUserMapper sysUserMapper;

    /**
     * 客户列表
     */
    @GetMapping("getUserList")
    @RolePermit(values = "admin")
    public TableInfo getUserList(UserListQuerys userListQuerys) {
        startPage();
        return getDataTable(sysUserMapper.queryUserTableList(userListQuerys));
    }

    /**
     * 删除客户
     */
    @DeleteMapping("/deleteUser/{userId}")
    @RolePermit(values = "admin")
    public void deleteUser(@PathVariable("userId") Long userId) {
        sysUserMapper.deleteUser(userId);
    }
}
